package com.itheima07;

import java.util.Collections;
import java.util.TreeSet;

/**
 * @author Xiao
 * @date 2021/7/26
 */
public class StudentTest {
    /**
     * 需求：
     *      1.定义Student类    姓名、年龄你们、分数
     *      2.创建几个学生对象添加到集合中
     *      3.实现排序效果：
     *          先按照分数排序，如果分数相同按照年龄排序，如果分数年龄都相同按照姓名排序
     */
    public static void main(String[] args) {
        Student stu1 = new Student("Lisa1",21,95);
        Student stu2 = new Student("Lisa1",21,96);
        Student stu3 = new Student("Lisa2",21,95);
        Student stu4 = new Student("Lisa3",21,96);
        Student stu5 = new Student("Lisa4",22,95);
        Student stu6 = new Student("Lisa3",21,96);
        TreeSet<Student> ts = new TreeSet<>();
        Collections.addAll(ts,stu1,stu2,stu3,stu4,stu5,stu6);
        for (Student t : ts) {
            System.out.println(t);
        }
    }
}
